﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NullableValue
{
    class Program
    {
        static void Main(string[] args)
        {
            bool? myNullableBoolean = null;

            if (myNullableBoolean != true)
                Console.WriteLine("True: myNullableBoolean != true");

            if (myNullableBoolean != false)
                Console.WriteLine("True: myNullableBoolean != false");

            if (myNullableBoolean ?? false == true)
                Console.WriteLine("True: myNullableBoolean ?? false == true");

            if ((myNullableBoolean ?? false) == true)
                Console.WriteLine("True: (myNullableBoolean ?? false) == true");

            try
            {
                var myInt = (int?)null;
                Console.WriteLine("It works!!!!: int? myInt = (int?)null;");
                Console.WriteLine(null == myInt ? "null" : myInt.Value.ToString());
            }
            catch (Exception ex)
            {
                Console.WriteLine("It does't work: int? myInt = (int?)null;");
            }

            Console.WriteLine(string.Compare("", null, true));

            Console.ReadKey();
        }
    }
}
